package cn.buk.tms.dto;

import cn.buk.common.util.DecimalUtil;
import cn.buk.tms.entity.misc.PaymentMethod;
import cn.buk.tms.entity.misc.Supplier;
import cn.buk.tms.common.dto.PaymentMethodDto;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

/**
 * 用于报表的酒店账单内容
 * @author william
 *
 */
public class ReportHotelDto extends ReportBaseDto {

	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date opDate;
    private String hotelName;
    private String roomType;

	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date checkIn;

	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date checkOut;

    private int roomCount;
    private double total;
    private double cost;
    private double profit;

    public ReportHotelDto(String hotelName, String roomType, Date checkIn, Date checkOut, int roomCount, double total, double cost, double profit,
                          Date opDate, String op1, String op2, String op3,
						  Integer customerType, Integer customerId, int billId, Supplier supplier, PaymentMethod pm) {
        super(op1, op2, op3, customerType, customerId);

        this.hotelName = hotelName;
        this.roomType = roomType;
        this.checkIn = checkIn;
        this.checkOut = checkOut;
        this.roomCount = roomCount;

        this.total = total;
        this.cost = cost;
        this.profit = profit;

        this.opDate = opDate;

        this.supplier = SupplierDto.createBySupplier(supplier);
        this.paymentMethod = PaymentMethodDto.create(pm.getId(), pm.getName());

        this.billId = billId;
    }

	private int billId;

    /**
     * 供应商
     */
	private SupplierDto supplier;

    /**
     * 出票付款方式
     */
	private PaymentMethodDto paymentMethod;


	public double getProfit() {
		return DecimalUtil.keepScale2(profit);
	}

	public void setProfit(double profit) {
		this.profit = profit;
	}


    public SupplierDto getSupplier() {
        return supplier;
    }

    public void setSupplier(SupplierDto supplier) {
        this.supplier = supplier;
    }

    public PaymentMethodDto getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(PaymentMethodDto paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

	public int getBillId() {
		return billId;
	}

	public void setBillId(int billId) {
		this.billId = billId;
	}

	public Date getOpDate() {
		return opDate;
	}

    public double getTotal() {
        return total;
    }

	public String getHotelName() {
		return hotelName;
	}

	public String getRoomType() {
		return roomType;
	}

	public Date getCheckIn() {
		return checkIn;
	}

	public Date getCheckOut() {
		return checkOut;
	}

	public int getRoomCount() {
		return roomCount;
	}

    public double getCost() {
        return cost;
    }
}
